import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

export default new  Vuex.Store({
    state:{
        user:{
            username:(localStorage.getItem('user')=="null"||localStorage.getItem('user')==null)?'尚未登录':JSON.parse(localStorage.getItem('user')).username
        },
        rs:[]
    },
    mutations:{
           login(Store,user){
               Store.user = user;
               localStorage.setItem('user',JSON.stringify(user));
           },
           initMenu(store,routers){
            store.rs = routers;
        }

    }
})